<?php
include APPPATH."views/frontend/inc/01_meta.php";
include APPPATH."views/frontend/inc/02_head.php";
?>
<div class="banner-product"
	style="<?php if(isset($config['BANNER PRODUCT DETAIL']))echo'background-image:url('.$config['BANNER PRODUCT DETAIL'].')' ?>"
></div>
<div class="navi">
	<a href="/home">Home</a>
	<span>/</span>
	<?php  
	if(!empty($product)){
		?>
		<a href="/category/<?php echo $cate_type['key'] ?>"><?php echo $cate_type['name'] ?></a>
		<?php
		foreach($product->link_cates as $l){
			echo "<span>/</span>$l";
		}
	}
	?>
	<div class="clear"></div>
</div>
<script type="text/javascript">
    related_config.Type = "<?php echo $cate_type['key'] ?>";
    related_config.CateId = "<?php if(!empty($product)) echo $product->product_category_id; ?>";
	related_config.Id = "<?php if(!empty($product)) echo $product->product_id; ?>";
	$(document).ready(function(){
		related_product();
		//similer_product();
		cartitem.init();
	});
</script>
<div>
	<?php
	if(!empty($product)){
		
	?>
	<form id="form-add-to-card" name="form-add-to-card" 
		action="" method="POST" onsubmit="return false;"
		target="integration_asynchronous" autocomplete="off">
		<input type="hidden" id="item-id" name="item-id" value="<?php echo $product->product_id ?>"/>
	<div class="col-sm-6">
		<div class="photogallery">
			<div class="list-photo">
				<?php
				$photos = explode(chr(10),$product->product_images);
				if(!empty($photos)){
					$n=0;
					foreach($photos as $img){
						$n++;
					?>
					<div class="thumb-photo <?php if($n==4) echo "last" ?>">
						<div class="nailthumb unhalf">
							<div class="nailthumb-figure">
								<div class="nailthumb-container">
									<img src="<?php echo $img?>" class="flu"  
                                         alt="<?php echo $product->product_title?>"/> 
								</div>
								<div class="nailthumb-mark"></div>
							</div>
						</div>
					</div>
					<?php
					}
				}
				?>
			</div>
			<div class="main-photo">
				<?php
				if(!empty($photos)){
				?>
				<img src="<?php echo $photos[0]?>" class="flu"  
									 alt="<?php echo $product->product_title?>"/>
				<?php
				}
				?>
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<div class="col-sm-6">
		<div class="product-info">
			<div class="line-group">
				<h3 class="c666">
					<?php echo $product->product_title?>
				</h3>
				<div>
					<span class="c999">Item code</span> : <span class="c333"><?php echo $product->product_code?></span>
				</div>
			</div>
			<div class="line-group">
				<h2 class="c31"><span class="dolar">£</span> <?php echo $product->product_price?></h2>
				<div style="padding:15px 0">
					<div class="row">
						<div class="col-sm-11">
							<div class="row">
								<div class="col-sm-4"  style="padding-bottom:15px">
									<div id="cart-item-size" class="dropdown">
										<a data-toggle="dropdown" href="#">Size</a>
										<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
											<?php
											if(!empty($sizes)){
												foreach($sizes as $tmp){
											?>
											<li><a href="JavaScript:" data-value="<?php echo $tmp->size_id?>" ><?php echo $tmp->size_name?></a></li>
											<?php
												}
											}//else echo '<li><a href="JavaScript:"></a></li>';
											?>
										</ul>
									</div>
									<input type="hidden" id="item-size" name="item-size" value=""/>
								</div>
								
								<div class="col-sm-4"  style="padding-bottom:15px">
									<div id="cart-item-color" class="dropdown">
										<a data-toggle="dropdown" href="#">Color</a>
										<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
											<?php
											if(!empty($colors)){
												foreach($colors as $tmp){
											?>
											<li><a href="JavaScript:" data-value="<?php echo $tmp->color_id?>"><?php echo $tmp->color_name?></a></li>
											<?php
												}
											}//else echo '<li><a href="JavaScript:"></a></li>';
											?>
										</ul>
									</div>
									<input type="hidden" id="item-color" name="item-color" value=""/>
								</div>
								
								<div class="col-sm-4"  style="padding-bottom:15px">
									<div class="dropdown">
										<a data-toggle="dropdown" href="#">Other</a>
										<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
											
										</ul>
									</div>
								</div>
								<div class="clear"></div>
							</div>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				<p style="padding:15px 0">
					Floral slip dress in jacquard fabric with cups and straps. 85cm length. 47% Acetate, 19% Viscose, 18% Linen, 16% Nylon. Machine washable.
				</p>
				<div style="padding:15px 0">
					<div class="row">
						<div class="col-sm-11">
							<div class="row">
								<div class="col-sm-4"  style="padding-bottom:15px">
									<span class="pull-left" style="line-height:30px">
									Quantity
									</span>
									<div id="cart-item-quantity" class="dropdown pull-right" style="width: 60px;">
										<a data-toggle="dropdown" href="#">1</a>
										<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
											<?php for($i=1;$i<=10 && $i<=(int)$product->product_amount;$i++){ ?>
											<li><a href="JavaScript:" data-value="<?php echo $i?>" ><?php echo $i ?></a></li>
											<?php } ?>
										</ul>
									</div>
									<input type="hidden" id="item-quantity" name="item-quantity" value="1"/>
									<div class="clear"></div>
								</div>
								<div class="clear"></div>
							</div>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				
				<div style="padding:15px 0">
					<div class="row">
						<div class="col-sm-11">
							<div class="row">
								<?php if((int)$product->product_amount>0){ ?>
								<div class="col-sm-6"  style="padding-bottom:15px">
									<div class="addtocart" onclick="cartitem.addtocart()">ADD TO CART</div>
								</div>
								<div class="col-sm-6"  style="padding-bottom:15px">
									<div class="delivery">DELIVERY</div>
								</div>
								<div class="clear"></div>
								<?php }else{ ?>
								
								<div class="col-sm-12">
									<div class="outofstock">This item is out of stock</div>
								</div>
								<div class="clear"></div>
								<?php } ?>
							</div>
						</div>
					</div>
					<div class="clear"></div>
				</div>
			</div>
		</div>
	</div>
	<div class="clear"></div>
	</form>
	<?php
	}else echo "Product not found !";
	?>
	
</div>
<div id="search-result" class="col-sm-12" id="product_related">
	<div class="search-loading"></div>
</div>
<div class="clear"></div>
<?php
include APPPATH."views/frontend/inc/03_foot.php";
?>